package com.baozun.houji.goods.adapter

import com.baozhun.mall.common.base.BaseListAdapter
import com.baozun.houji.goods.BR
import com.baozun.houji.goods.R
import com.baozun.houji.goods.databinding.ItemHomeTopCategoryChildBinding
import com.baozun.houji.goods.model.bean.HomeGoldenBean
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder

/**
 * @Title：三级分类适配器
 * @Description：
 * @Author：xing.luo
 * @Since：2022/11/10
 * @Version：1.0.0
 */
class HomeTopCategoryChildAdapter(
    data: MutableList<HomeGoldenBean>?,
    private var onItemChildClickListener: (model: HomeGoldenBean) -> Unit?,
) :
    BaseListAdapter<HomeGoldenBean, ItemHomeTopCategoryChildBinding>(R.layout.item_home_top_category_child, data) {

    override fun convert(holder: BaseDataBindingHolder<ItemHomeTopCategoryChildBinding>, item: HomeGoldenBean) {
        super.convert(holder, item)
        holder.dataBinding?.setVariable(BR.model, item)
        holder.dataBinding?.executePendingBindings()
        holder.itemView.setOnClickListener { onItemChildClickListener?.invoke(item) }
    }
}